<template>
  <div class="block">
    <el-pagination
      :page-sizes="[2, 4, 6, 8, 10]"
      :page-size="limit"
      layout="total, sizes, prev, pager, next, jumper"
      :total="count"
      background
      :pager-count="5"
      :current-page="page"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
</template>

<script>
export default {
  props: {
    limit: {
      type: Number,
      default: 10
    },
    count: {
      type: Number,
      default: 0
    },
    page: {
      type: Number,
      default: 0
    }
  },
  methods: {
    handleSizeChange(val) {
      this.$emit('update:limit', val)
    },
    handleCurrentChange(val) {
      this.$emit('update:page', val)
    }
  }

}
</script>

<style>
.el-pagination {
  text-align: right;
  margin-top: 20px;
}
</style>
